<?php

/**
 * This is the model class for table "exit_sign".
 *
 * The followings are the available columns in table 'exit_sign':
 * @property integer $id
 * @property integer $exit_sign_illuminated
 * @property string $esi_location
 * @property string $source_of_power
 * @property string $other
 * @property integer $readily_visible
 * @property integer $minimum_letter_size
 * @property integer $exit_route_plan_posted_on_lobby_or_hallway
 * @property integer $room
 * @property integer $directional_exit_sign
 * @property string $des_location
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class ExitSign extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ExitSign the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
        const a = "AC/DC";
const b ="Others";
public function getSource_of_power(){
return array(
self::a=>"AC/DC",
self::b=>"Others"
);


}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'exit_sign';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('exit_sign_illuminated, readily_visible, minimum_letter_size, exit_route_plan_posted_on_lobby_or_hallway, room, directional_exit_sign, inspection_id', 'numerical', 'integerOnly'=>true),
			array('source_of_power', 'length', 'max'=>6),
			array('esi_location, other, des_location', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, exit_sign_illuminated, esi_location, source_of_power, other, readily_visible, minimum_letter_size, exit_route_plan_posted_on_lobby_or_hallway, room, directional_exit_sign, des_location, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'exit_sign_illuminated' => 'Exit Sign Illuminated',
			'esi_location' => 'Esi Location',
			'source_of_power' => 'Source Of Power',
			'other' => 'Other',
			'readily_visible' => 'Readily Visible',
			'minimum_letter_size' => 'Minimum Letter Size',
			'exit_route_plan_posted_on_lobby_or_hallway' => 'Exit Route Plan Posted On Lobby Or Hallway',
			'room' => 'Room',
			'directional_exit_sign' => 'Directional Exit Sign',
			'des_location' => 'Des Location',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('exit_sign_illuminated',$this->exit_sign_illuminated);
		$criteria->compare('esi_location',$this->esi_location,true);
		$criteria->compare('source_of_power',$this->source_of_power,true);
		$criteria->compare('other',$this->other,true);
		$criteria->compare('readily_visible',$this->readily_visible);
		$criteria->compare('minimum_letter_size',$this->minimum_letter_size);
		$criteria->compare('exit_route_plan_posted_on_lobby_or_hallway',$this->exit_route_plan_posted_on_lobby_or_hallway);
		$criteria->compare('room',$this->room);
		$criteria->compare('directional_exit_sign',$this->directional_exit_sign);
		$criteria->compare('des_location',$this->des_location,true);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}